import requests


class ZshjPostMangerApi(object):
    # 定义添加岗位方法
    def add_post(self, req_heder, req_body):
        # 添加岗位
        resp = requests.post(url="http://192.168.43.115:1111/admin/system/sysPost/save",
                             headers=req_heder,
                             json=req_body)

        return resp

    # 定义查询岗位方法
    def query_post(self, role_id, req_header):
        # 查询岗位
        resp = requests.get(url="http://192.168.43.115:1111/admin/system/sysPost/get/" + role_id,
                            headers=req_header)
        return resp

    # 定义修改岗位方法
    def update_post(self, req_header, req_body):
        # 修改岗位
        resp = requests.put(url="http://192.168.43.115:1111/admin/system/sysPost/update",
                            headers=req_header,
                            json=req_body)

        return resp

    def delete_post(self, role_id, req_header):
        # 删除岗位
        resp = requests.delete(url="http://192.168.43.115:1111/admin/system/sysPost/remove/" + role_id,
                               headers=req_header)

        return resp


if __name__ == '__main__':
    # 创建实例化
    zshjrole = ZshjPostMangerApi()
    # 准备请求头
    req_header = {
        "token": "eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAKtWKi5NUrJScgwN8dANDXYNUtJRSq0oULIyNDcwNjExtTC01FEqLU4t8kwBikGYeYm5qUAtiSm5mXlKtQB2PL6VQgAAAA.fszietAhTSkoGJ1MhPB01BarWOrw9CtyYKT0QGwNrpJfBZHm94F3OzPruvyRDTJ9wZrn7_Ak5oLnLqR20Tpltw"}